<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>背景+导航栏</title>
    <link rel="shortcut icon" href="fa.ico" type="image/x-icon">
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

    <style media="screen">
      *{
        margin: 0px;
        padding: 0px;
      }
      /*背景层*/
      .bg-main img{
        position: absolute;
      }
      .bg-main img{
        width: 100%;
        height: 100%;
      }
      /*头部*/
      .header{
        height: 150px;
        width: 100%;
        position: absolute;
        background-color: rgba(80,80,80,0.4);
        /*background-color: lightgray;*/
      }
      /*头部的导航栏*/
      .header_nav{
        /*position: relative;
        top: 103px;
        float:right*/
        float: right;
        margin-top: 103px;
      }
      ul{
        list-style-type: none;
      }
      li{
        float: left;
      }
      a:link,a:visited{
        display: block;
        background-color: #98bf21;
        /*opacity: 0.4;
        filter: alpha(opacity=40);*/
        /*background-color: rgab(152,191,33,0.8);*/
        text-decoration: none;
        color: #fff;
        font-weight: bold;
        text-align: center;
        text-transform: uppercase;
        width: 150px;
        line-height: 38px;
        font-size: 20px;
        padding: 4px;
        border-radius: 7px;  /*圆角*/
      }
      a:hover,a:active{
        background-color: #7A991A;
      }
    </style>
  </head>
  <body>
    <!-- 背景层 -->
    <div class="bg">
      <div class="bg-main">
        <img src="img/slide2.jpg" alt="背景图片">
      </div>
    </div>
    <!-- 头部 -->
    <div class="header">
      <!-- 头部的导航栏 -->
      <div class="header_nav">
        <ul>
          <li>
            <a href="#home">
              <span class="glyphicon glyphicon-home"></span> Home
            </a>
          </li>
          <li><a href="#news">News</a></li>
          <li><a href="#service">Service</a></li>
          <li>
            <a href="#aboutme">
              <span class="glyphicon glyphicon-user"></span> About me
            </a>
          </li>
          <li><a href="#contact">Contact</a></li>
          <li><a href="#Legal">Legal</a></li>
          <li> <a href="#more">More</a></li>
          <li>
            <button type="button" class="btn btn-lg btn-success">User
            <span class="glyphicon glyphicon-user"></span>
            </button>
          </li>
        </ul>
      </div>
    </div>
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  </body>
</html>
